<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let url = "http://172.100.101.1:8080/html/login.html?apmac=1c3d2f39b320&uaddress=172.100.102.49&umac=42d6d6f4c2d3&authType=10&lang=zh_CN&ssid=V0FUU09OU1dJRkk=&pushPageId=8183047bff874764840050bef51997f1&nodeIp=10.21.10.51&siteId=c51e0c54-60d5-482a-974c-e8be74274a75&storeName=%E6%9C%AA%E7%9F%A5&clientAccessExpire=3600000"
        let search = url.substr(url.indexOf("?"))
        if (location.search.indexOf("ssid") == -1) {
            // location.search = search 
        }

        function replaceUrlMac(url, paramKey) {
            if (url.indexOf(paramKey) != -1) {
                let paramValue = url.substring(url.indexOf(paramKey) + paramKey.length + 1, url.indexOf("&", url.indexOf(paramKey)))
                if (paramValue.indexOf(":") != -1) {
                    return;
                }
                let temMac = formatMac(paramValue)
                url = url.replace(paramKey + "=" + paramValue, paramKey + "=" + temMac)
            }
        }
      
        function formatMac(mac) {
            let tempMac = "";
            for (let i = 0; i < mac.length; i += 2) {
                tempMac += mac[i] + mac[i + 1] + ":"
            }
            tempMac = tempMac.substr(0, tempMac.length - 1)
            return tempMac;
        }
        replaceUrlMac(url, "umac")
        replaceUrlMac(url, "apmac")
    </script>
</body>

</html>